import React from 'react';
import dynamic from 'dva/dynamic';
import { Route } from 'dva/router';
import { isToken } from '../utils/judgmentEquipment.js'

export default function collectionListRoute(app) {
    const Login = dynamic({
      app,
      models: () => {
        return [
          import(/* webpackChunkName: "loginModel" */'../models/login/loginModel'),
        ];
      },
      component: () => import(/* webpackChunkName: "login" */'../routes/login/login'),
    });

    const CollectionList = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "collectionListModel" */'../models/collectionList/collectionListModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "collectionList" */'../routes/collectionList/collectionList'),
    });

    return (
        [
            <Route key="/collectionList" exact path="/collectionList/:isStore" children={(props) => isToken() ? <CollectionList {...props}/>  : <Login {...props} /> }/>,
        ]
    );
}
